<h1>订单列表</h1>
<table class="order_list"  cellpadding="0" cellspacing="0" >
  <tr>
    <td>编号</td>
    <td>下单时间</td>
    <td>总金额</td>
    <td>下单人</td>
    <td>状态</td>
    <td colspan="3"></td>
  </tr>
  <% for order in @orders %>
    <tr>
      <td><%= order.id%></td>
      <td><%= order.created_at.strftime("%y-%m-%d %I:%M%p") %></td>
      <td><%= number_to_currency(order.real_total_price,:unit => "&yen;")%></td>
      <td><%= order.user.login %></td>
      <td><%= format_status(order.status) %></td>
      <td><%= link_to '明细', order %></td>
      <td><%= link_to '编辑', edit_order_path(order) %></td>
      <td><%= link_to '取消', order, :confirm => 'Are you sure?', :method => :delete %></td>
    </tr>
    <tr style="display:none" id="order_<%= order.id%>">
      <td colspan="7">
        <div>
          <ul>
            <% for item in order.line_items %>
              <li><%=item.product.name%>(<%=number_to_currency(item.price,:unit => "&yen;")%>)&times;<%=item.quantity%>小计:<%=number_to_currency(item.real_total_price,:unit => "&yen;")%></li>
            <% end %>
          </ul>
        </div>
      </td>
    </tr>
  <% end %>
</table>

<br />
<%= will_paginate @orders,:prev_label => '«上一页',:next_label => '下一页»' %>
